
Shader	=	function (id)
{
	this.node	=	document.getElementById(id);

	if (!this.node) 			//	In case the shader doesn't exist
		return null;

	var str 	= "";
	var k 		= this.node.firstChild;
	
	while (k)
	{
		if (k.nodeType == 3) 
		{
			str += k.textContent;
		}
		
		k = k.nextSibling;
	}
	
	this.shader;
	
	if (this.node.type == "x-shader/x-fragment") {
		this.shader = gl.createShader(gl.FRAGMENT_SHADER);
	} else if (this.node.type == "x-shader/x-vertex") {
		this.shader = gl.createShader(gl.VERTEX_SHADER);
	} else {
		return null;
	}
	
	gl.shaderSource(this.shader, str);
	gl.compileShader(this.shader);

	if (!gl.getShaderParameter(this.shader, gl.COMPILE_STATUS)) {
		alert(gl.getShaderInfoLog(this.shader));
		return null;
	}
}
